define("pages/jls_cs/qjcsmain", [
	 "../../plugins/easyui/jquery-easyui-1.5.1/jquery.easyui.min",
     "../../plugins/easyui/jquery-easyui-1.5.1/easyloader",
	"../../upload",
    "../../pages/kss_ts/formglws.js",
    "../../common/kss",
    "../../plugins/artTemplate/artTemplate",
    "../../common/componts",
    "../../common/tools",
    ],
    function(require) {
	var wsbdjbxxid = "wsbdjbxxId";
	var comonts=require("../../common/componts");
	 
	 



        var initHtml = function(){
            var user_permission = 2 ; 	//设置获取到的用户权限
            var rsdj_permission = 2 ;	//设置出所管理需要的权限
            var container = document.getElementById("main");
            var graph = new mxGraph(container);
            var parent = graph.getDefaultParent();

            graph.setHtmlLabels(true);

            graph.setEnabled(false);

            var style = {};

            style = graph.getStylesheet().getDefaultEdgeStyle();//圆角连线
            style[mxConstants.STYLE_ROUNDED] = true;//圆角连线
            style = mxUtils.clone(style);
            style[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_LABEL;  // 不设置这个属性 背景图片不出来

            style[mxConstants.STYLE_STROKECOLOR] = '#f5f5f5';

            style[mxConstants.STYLE_FILLCOLOR] = '#f5f5f5';

            style[mxConstants.STYLE_FONTCOLOR] = 'black';

            style[mxConstants.STYLE_ALIGN] = mxConstants.ALIGN_CENTER;

            style[mxConstants.STYLE_VERTICAL_ALIGN] = mxConstants.ALIGN_BOTTOM;

            style[mxConstants.STYLE_FONTSIZE] = 13;

            style[mxConstants.STYLE_IMAGE_ALIGN] = 0;

            style[mxConstants.STYLE_IMAGE_VERTICAL_ALIGN] = 0;

            style[mxConstants.STYLE_IMAGE] = '../../img/lcttx.png';

            style[mxConstants.STYLE_IMAGE_WIDTH] = 80;

            style[mxConstants.STYLE_IMAGE_HEIGHT] = 80;

            style[mxConstants.STYLE_SPACING_TOP] = 30;

            style[mxConstants.STYLE_SPACING] = 0.5;

            graph.getStylesheet().putCellStyle("style1", style);

            var style2 = {};

            style2 = graph.getStylesheet().getDefaultEdgeStyle();//圆角连线
            style2[mxConstants.STYLE_ROUNDED] = true;//圆角连线
            style2 = mxUtils.clone(style);
            style2[mxConstants.STYLE_SHAPE] = mxConstants.SHAPE_LABEL;  // 不设置这个属性 背景图片不出来

            style2[mxConstants.STYLE_STROKECOLOR] = '#f5f5f5';

            style2[mxConstants.STYLE_FILLCOLOR] = '#f5f5f5';

            style2[mxConstants.STYLE_FONTCOLOR] = 'black';

            style2[mxConstants.STYLE_ALIGN] = mxConstants.ALIGN_CENTER;

            style2[mxConstants.STYLE_VERTICAL_ALIGN] = mxConstants.ALIGN_BOTTOM;

            style2[mxConstants.STYLE_FONTSIZE] = 13;

            style2[mxConstants.STYLE_IMAGE_ALIGN] = 0;

            style2[mxConstants.STYLE_IMAGE_VERTICAL_ALIGN] = 0;

            style2[mxConstants.STYLE_IMAGE] = '../../img/zh.png';

            style2[mxConstants.STYLE_IMAGE_WIDTH] = 80;

            style2[mxConstants.STYLE_IMAGE_HEIGHT] = 80;

            style2[mxConstants.STYLE_SPACING_TOP] = 30;

            style2[mxConstants.STYLE_SPACING] = 0.5;

            graph.getStylesheet().putCellStyle("style2", style2);




            //获取流程节点的待办数量
            var jbdjCount=0;
            var jbqrCount=0;



            // 画人物
            var v1 = graph.insertVertex(parent, 'sqdb', '申请担保<font color="jbdj"></font>', 120, 220, 100, 105, "style2");

            var v2 = graph.insertVertex(parent, 'qjcp', '请假呈批<font color="jbqr"></font>', 320, 220, 100, 105, "style1");

            var v3 = graph.insertVertex(parent, 'szyj', '所长意见<font color="jbqr"></font>', 520, 220, 100, 105, "style2");

            var v4 = graph.insertVertex(parent, 'zgyj', '主管意见<font color="jbqr"></font>', 720, 220, 100, 105, "style2");

            var v5 = graph.insertVertex(parent, 'bzjsq', '保证金收取<font color="jbqr"></font>', 920, 100, 100, 105, "style2");
            var v6 = graph.insertVertex(parent, 'lsdj', '离所登记<font color="jbqr"></font>', 920, 220, 100, 105, "style2");
            var v7 = graph.insertVertex(parent, 'cwfh', '财物返还<font color="jbqr"></font>', 920, 340, 100, 105, "style2");

            var v9 = graph.insertVertex(parent, 'dqwgcl', '到期未归处理<font color="jbqr"></font>', 1020, 100, 100, 105, "style1");
            var v10 = graph.insertVertex(parent, 'yqjry', '已请假人员<font color="jbqr"></font>', 1020, 340, 100, 105, "style1");




            // 连线
            graph.insertEdge(parent, null, '',v1, v2 , "edgeStyle=elbowEdgeStyle;");
            graph.insertEdge(parent, null, '',v2, v3 , "edgeStyle=elbowEdgeStyle;");
            graph.insertEdge(parent, null, '',v3, v4 , "edgeStyle=elbowEdgeStyle;");
            graph.insertEdge(parent, null, '',v4, v5 , "edgeStyle=elbowEdgeStyle;");
            graph.insertEdge(parent, null, '',v4, v6 , "edgeStyle=elbowEdgeStyle;");





            //添加事件
            graph.addListener(mxEvent.CLICK, function(sender, evt) {
                var cell11 = evt.getProperty('cell');
                //graph.setCellStyles(fillColor,black);
                if(cell11==null){
                    $("#pictureId").css({"display":"none"});
                    return ;
                }else if(cell11.id=='jypz'){
                    window.location.href='';
                }else if (cell11.id=='qjcp'){
                    window.location.href='/jls_cs/qjsp.html';
                }else if(cell11.id=='jydj'){
                    window.location.href='';
                }else if(cell11.id=='jydj'){
                    window.location.href='';
                }else if(cell11.id=='jydj'){
                    window.location.href='';
                }else if(cell11.id=='jydj'){
                    window.location.href='';
                }else if(cell11.id=='jydj'){
                    window.location.href='';
                }else if(cell11.id=='dqwgcl'){
                    window.location.href='/jls_cs/dqwgcl.html';
                }else if(cell11.id=='yqjry'){
                    window.location.href='/jls_cs/yqjry.html';
                }

            });
            //鼠标悬浮效果
            var track = new mxCellTracker(graph);
            var self = this;
            track.mouseMove = function(sender, me) {
                var cell1 = this.getCell(me);
                if(cell1==null){
                    $("#pictureId").css({"display":"none"});
                    return ;
                }else{
                    if(cell1.id=="tscldj"){
                        $("#pictureId").css({"display":"block","left":"250px","top":"170px"});
                        $("#pictureId").html("投诉处理登记登记！");
                    }else if (cell1.id=="ldsp"){
                        $("#pictureId").css({"display":"block","left":"550px","top":"170px"});
                        $("#pictureId").html("领导审批！");
                    }else if (cell1.id=="cldjcljg"){
                        $("#pictureId").css({"display":"block","left":"850px","top":"170px"});
                        $("#pictureId").html("登记处理结果！");
                    }
                }
            };
            //
            function bodyScale(){
                var main = document.getElementById("main"); //获取id="main"
                var devicewidth=document.documentElement.clientWidth;
                var scale=devicewidth/1275;//除去当前流量器分辨率1275
                main.style.zoom=scale;//zoom是设置或检索对象的缩放比例.
            }
            window.onload=window.onresize=function(){
                bodyScale();
            }
            //自适应任何设备屏幕
            function bodyScale(){
                var main = document.getElementById("main"); //获取id="main"
                var devicewidth=document.documentElement.clientWidth;
                var scale=devicewidth/1275;//除去当前流量器分辨率1275
                main.style.zoom=scale;//zoom是设置或检索对象的缩放比例.
            }
            window.onload=window.onresize=function(){
                bodyScale();
            }
        }
        
        var tableInit = function(){
        	 comonts.initTable(wsbdjbxxid,{
                 url:"/kss_jbxx/jbxxList",
                 title:'',
                 width:'98.5%',
                 fit:true,
                 tools:'#wsbdyc',
                 columns :  [
                     {
                         field: 'oid',
                         title: '序号',
                         formatter: function(value, rowData, rowIndex){
                             return '<input type="radio" name="ryRadio" id="ryRadio' + rowIndex + '" value="' + rowData.oid + '" />';
                         }},
                     {field : 'jsh',width : 150,title:'监室号',sortable:'true',formatter: function(value,row,index){return '<span title='+(row.jsh==null?"":row.jsh)+'>'+(row.jsh==null?"":row.jsh)+'</span>'}},
                     {field : 'xm',title : '姓名',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xm==null?"":row.xm)+'>'+(row.xm==null?"":row.xm)+'</span>'}},
                     {field : 'bm',title : '别名',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.bm==null?"":row.bm)+'>'+(row.bm==null?"":row.bm)+'</span>'}},

                     {field : 'xb',title : '性别',width : 80,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.xbString==null?"":row.xbString)+'>'+(row.xbString==null?"":row.xbString)+'</span>'}},
                     {field : 'ab',title : '案别',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.ab==null?"":row.ab)+'>'+(row.ab==null?"":row.ab)+'</span>'}},
                     {field : 'bahjString',title : '办案环节',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.bahjString==null?"":row.bahjString)+'>'+(row.bahjString==null?"":row.bahjString)+'</span>'}},
                     {field : 'rsrq',title : '入所日期',width : 150,sortable:'true',formatter: function(value,row,index){return '<span title='+(row.rsrq==null?"":row.rsrq)+'>'+(row.rsrq==null?"":row.rsrq)+'</span>'}},
                     {field:'operate',title:'详细信息',align:'center',width : 60,/*width:$(this).width()*0.15,*/
                         formatter:function(value, row, index){
                             var str = '<a href="#" data-target="#ckPhoto"  name="opera" data-toggle="modal" class="easyui-linkbutton"><img src="../../img/xq.png"></a>';
                             return str;
                             //return  '<button id="sh_add" onclick="add"  > 不通过</button>'
                         }
                     }
                 ] ,
                 //基本信息双击事件
                 onDblClickRow:function(rowIndex, rowData){
                     $("input[name='ryRadio']")[rowIndex].checked = true;
                     $("#"+wsbdjbxxid).datagrid("selectRow", rowIndex);
                     selectid=rowData.id;
                 },

                 onLoadSuccess:function(data){
                     if(data.total>0){
                         $('#'+wsbdjbxxid).datagrid("selectRow", 0);
                         $("input[name='ryRadio']")[0].checked = true;
                     }
                     $("a[name='opera']").on('click',function(){
                         var jbxx = $('#'+wsbdjbxxid).datagrid("getSelected");
                         kss.initJbxxxx(jbxx.gcbh,jbxx.rybh,jbxx.xm+"--详细信息");
                     });

                 },
                 //单击行选中取消事件
                 onClickRow:function(rowIndex, rowData){
                     if(selectid!=rowData.id){
                         $("input[name='ryRadio']")[rowIndex].checked = true;
                         selectid=rowData.id;
                     }else{
                         $("#"+wsbdjbxxid).datagrid("unselectRow",rowIndex);
                         $("input[name='ryRadio']")[rowIndex].checked = false;
                         $('#'+wsbdjbxxid).datagrid('clearSelections');
                         selectid="";
                     }
                     kss.zjryClick(rowData);
                 },
                 onSelect:function(rowIndex, rowData){
                 },
                 rightmenu:function(){
                     //kss.initJbxxRightMenu(jbxxrightmenuid);
                 },
             });
        	 $('#wsbdjbxxId').datagrid('resize',{
        	        height:($(window).height()-160),
        	    });
        	
        }




        var initView=function(){
            console.info("进入rsdj的sea.js");
            initHtml();
            tableInit();
        }
        initView();

    });
